fix(version): populate /version/ git_sha and built_at in deployed envs (#1366)#1371
Merged
Conversation
#1366) The /version/ endpoint reported git_sha and built_at as "unknown" on the servers. Two root causes in the build-info capture: - git was never installed in the image, so `git rev-parse` in docker-entrypoint.sh always failed -> git_sha "unknown". - Even with git present, /code/.git is apache:makelab-owned on the servers while the container runs as root, so git's "dubious ownership" guard would refuse to run rev-parse. Installs git in the Dockerfile and runs `git -c safe.directory=/code -C /code rev-parse`. The Dockerfile change also forces an image rebuild on the next deploy, so the entrypoint re-runs and actually writes build-info.json (the live container predated #1366, hence built_at was unknown too). Verified locally: the entrypoint commands now write a real short SHA + timestamp and /version.json reflects both. build-info.json stays gitignored. Bumps version to 2.17.2. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1366. On the deployed servers,
/version/reported"git_sha": "unknown"and"built_at": "unknown".Root causes
gitwas never installed in the image.docker-entrypoint.shrunsgit rev-parseto capture the deployed SHA, but the Dockerfile only installed imagemagick / ghostscript / sqlite3 — so the command always failed →git_sha: "unknown"./code/.gitisapache:makelab-owned while the container runs as root; even with git installed,git rev-parsewould refuse with "detected dubious ownership in repository".built_atwas also unknown because the build-info step only runs at container start, and the live prod container predates Add a JSON version/build-info endpoint (e.g. /version/) to make the deployed code version easy to check #1366 — code updates reach it via the bind-mount + autoreload, but the entrypoint never re-ran, sobuild-info.jsonwas never written.Fix
gitin the Dockerfile.git -c safe.directory=/code -C /code rev-parse --short HEADin the entrypoint (-cis process-local — no global git config side effects).docker compose up -drecreates the container → the entrypoint re-runs and writesbuild-info.json.Verification (local)
Ran the exact entrypoint commands in the container:
and
/version.jsonthen reported both.build-info.jsonremains gitignored.Bumps version to 2.17.2.
🤖 Generated with Claude Code